package cn.rongdao.jrkabao.base;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import android.view.View;

import cn.rongdao.jrkabao.ui.cashadvance.manager.LivenessManager;

/**
 * Created by jack on 2017/11/25
 */

public abstract class BaseLivenessActivity extends BaseAutoFinishActivity {

    private LivenessManager livenessManager;

    @Override
    protected void initView() {
        super.initView();
        livenessManager=new LivenessManager(this);
        livenessManager.setNeedFinish(isNeedFinish());
    }

    public void initLivenessDialog(final View view) {
        livenessManager.initLivenessDialog(view);
    }

    public void startLivenessActiviity(View view) {
        livenessManager.startLivenessActiviity(view);
    }


    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
        livenessManager.onRequestPermissionsResult(requestCode,permissions,grantResults);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        livenessManager.onActivityResult(requestCode,resultCode,data);
    }

    protected boolean isNeedFinish() {
        return true;
    }

    public void setInstitutionId(String institutionId) {
        livenessManager.setInstitutionId(institutionId);
    }

    public void setIsMyAccount(boolean isMyAccount) {
        livenessManager.setIsMyAccount(isMyAccount);
    }
}
